define(["jquery", "easy-admin"], function ($, ea) {

    var form = layui.form
        , upload = layui.upload;
    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'mall.service/index',
        edit_url: 'mall.service/edit',
        export_url: 'mall.service/export',
    };

    var Controller = {
        index: function () {
            ea.table.render({
                init: init,
                height:'full-50',
                toolbar: ['refresh',
                    [],
                    'export'],
                cols: [[
                    {type: "checkbox"},
                    {field: 'id', width: 80, title: 'ID'},
                    {field: 'ordersn', minWidth: 120, title: '订单号'},
                    {field: 'mobile', minWidth: 80, title: '联系电话'},
                    {field: 'refund_money', width: 100, title: '实付金额',search: false, templet: ea.table.price},
                    {field: 'realrefund_money', width: 100, title: '实退金额',search: false, templet: ea.table.price},
                    {field: 'paytype', title: '支付方式', width: 100, selectList: {1: '微信支付', 2: '余额支付'}},
                    {field: 'status', title: '状态', width: 100, selectList: {0: '待处理', 1: '退款完成'}},
                    {field: 'create_time', minWidth: 80, title: '申请时间', search: 'range'},
                    {field: 'refund_time', minWidth: 80, title: '退款时间', search: 'range'},
                    {
                        width: 250,
                        title: '操作',
                        templet: ea.table.tool,
                        operat: [
                            [{
                                text: '售后详情',
                                url: init.edit_url,
                                method: 'open',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-xs layui-btn-normal',
                                extend: 'data-full="true"',
                            }],
                        ]
                    }
                ]],
            });

            ea.listen();
        },
        edit: function () {
            ea.listen();
        }
    };
    return Controller;
});